'use strict';

/**
 * 从指定的HTML元素上删除指定的class
 * @param {Element} element 
 * @param {String} className 
 */
export function removeClass(element, className) {

    const original = element.className;

    if (original.length === 0) {
        return;
    }

    if (original == className) {
        element.className = '';
        return;
    }

    if (original.match(new RegExp('(^|\\s)' + className + '(\\s|$)'))) {
        element.className = original.replace((new RegExp('(^|\\s)' + className + '(\\s|$)')), '');
    }
} 